//
//  UTime.h
//  UltraStarDeluxeIOS
//
//  Created by 李 杰军 on 12-7-14.
//  Copyright (c) 2012年 DoReiMi. All rights reserved.
//

#ifndef UltraStarDeluxeIOS_UTime_h
#define UltraStarDeluxeIOS_UTime_h

#include "sdl.h"

enum TRelativeTimerState
{
    rtsStopped = 0,
    rtsWait,
    rtsPaused,
    rtsRunning,
};

class TTime
{
public:
    TTime();
    float GetTime();
};

class TRelativeTimer
{
private:
    Uint32 AbsoluteTime;
    float RelativeTime;
    bool TriggerMode;
    TRelativeTimerState State;
    
public:
    TRelativeTimer();
    void Start(bool WaitForTriggers = false);
    void Pause();
    void Stop();
    float GetTime();
    void SetTime(float Time);
    TRelativeTimerState GetState();
};

class TSyncSource
{
public:
    virtual float GetClock() = 0;
};

extern TTime USTime;
extern TRelativeTimer VideoBGTimer;

extern Uint32 TimeNew;
extern Uint32 TimeOld;
extern float TimeSkip;
extern float TimeMid;
extern Uint32 TimeMidTemp;

void CountSkipTimeSet();
void CountSkipTime();
void CountMidTime();

#endif
